<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 400px;
            height: 400px;
            overflow: scroll;
        }
        p{
            height: 800px;
            width: 800px;
        }
    </style>
</head>
<body>
    <div>
        <p></p>
    </div>
    <button>获取</button>
    <script>
        document.querySelector('button').onclick=function(){
            console.log('滚动的距离',document.querySelector('div').scrollTop);
            console.log('滚动的距离',document.querySelector('div').scrollHeight);
            console.log('内容的高度',window.getComputedStyle(document.querySelector('div')).height);
        }
    </script>
</body>
</html>